<?php
/* @var $this UsuarioController */
/* @var $model Usuario */

$this->breadcrumbs=array(
	'Usuarios'=>array('index'),
	'Gerenciar',
);

$this->menu=array(
	array('label'=>'Cadastrar Usuario', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#usuario-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Gerenciar Usuarios</h1>



<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'usuario-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'id',
		'perfil_id',
		'usuario',
		'senha',
		'email',
		'nome',
		/*
		'endereco',
		'telefone',
		*/
		 array(
                        'class'=>'CButtonColumn',
						'template'=>' {editar} {delete}',
              'buttons'=>array
    (
        'editar' => array
        (
            'label'=>'Send an e-mail to this user',
            'imageUrl'=>Yii::app()->request->baseUrl.'/images/update.png',
            'url'=>'Yii::app()->createUrl("usuario/editar", array("id"=>$data->id))',
        ),
		'delete' => array
        (
            'url'=>'Yii::app()->createUrl("usuario/delete", array("id"=>$data->id))',
			'visible'=>('$data->id != Yii::app()->user->id ? true : false'),
        )
                )   
	),
))); ?>
